package com.shaonianyou.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.common.collect.Maps;

/**
 * 我的业绩
 * 
 * @author Empty
 *
 */
@Controller
@RequestMapping("/performance")
public class PerformanceController extends BaseController {

	/**
	 * 我的业绩 - 个人项目查询
	 * 
	 * @param custId
	 * @return
	 */
	@RequestMapping("/queryMyProject/{pageIndex}")
	@ResponseBody
	public Map<String, Object> queryMyProject(HttpServletRequest request, String custId, @PathVariable String pageIndex) {
		Map<String, Object> param = Maps.newHashMap();
		param.put("pageIndex", pageIndex);
		if (!StringUtils.isBlank(custId)) {
			param.put("custId", custId);
		} else {
			param.put("custId", request.getSession().getAttribute("custId"));
		}
		Map<String, Object> result = doPost("/myProject", param);
		return result;
	}

	/**
	 * 我的业绩 - 奖励积分查询
	 * 
	 * @param custId
	 * @return
	 */
	@RequestMapping("/queryMyReward/{pageIndex}")
	@ResponseBody
	public Map<String, Object> queryMyReward(HttpServletRequest request, String custId, @PathVariable String pageIndex) {
		Map<String, Object> param = Maps.newHashMap();
		param.put("custId", request.getSession().getAttribute("custId"));
		param.put("pageIndex", pageIndex);
		return doPost("/myReward", param);
	}

}
